/*******************************************************************************
 * Copyright (c) 2010 Mikhail Garber.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License (LGPL)
 * which accompanies this distribution
 * 
 * Contributors:
 *     Mikhail Garber - initial API and implementation
 ******************************************************************************/
package plumber.model;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

import plumber.common.WithId;

/**
 * represents a particular work Flow in the model.
 * a Flow has a name, a first Step and a collection of Steps
 * @author mgarber
 *
 */
@SuppressWarnings("serial")
public class Flow extends WithId  {

	
	private Set<FlowStep> steps; 
	
	private String name;
	private FlowStep firstStep;
	
	
	public FlowStep getFirstStep() {
		return firstStep;
	}


	public void setFirstStep(FlowStep firstStep) {
		this.firstStep = firstStep;
	}

	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}


	public Set<FlowStep> getSteps() {
		if(steps == null) {
			return null;
		}
		return Collections.unmodifiableSet(steps);
	}

	
	public void setSteps(Set<FlowStep> steps) {
		this.steps = new HashSet<FlowStep>(steps);
	}


	@Override
	public String toString() {
		return "\n\nflow->" +name + "\n\n" + this.steps;
	}

	
	
	
}
